
const { cloud, getOpenid } = require('../dbCloud');
const schedule = require("node-schedule");



const sendAddAccountMsg = () => {
  cloud.openapi.subscribeMessage.send({
    touser: getOpenid(),
    page: 'index',
    lang: 'zh_CN',
    data: {
      thing3: {
        value: '339208499'
      },
      time1: {
        value: '2015年01月05日'
      }
    },
    templateId: 'HjeQIg5dw0WHq7VINKhGL0BDWToX1ElpeWbFcmF8-fo',
    miniprogramState: 'developer'
  });
};

// 初始化任务
const initTask = () => {
  schedule.scheduleJob('30 * * * * *', () => {
    sendAddAccountMsg();
  });
};

module.exports = {
  initTask
};